<html> 
<head>
<title>Editing Test: extend selection and bold</title> 
</head> 
<body>
<p>This tests bolding the first 21 letters in the following sentence.  Every character (including spaces) before "jumps" must be bolded.
<div contenteditable id="root" class="editing">
<span id="test">"The quick brown fox jumps over the lazy dog" uses every
letter in the english language.
</span>
</div>
<p id="console"></p>

<script>

if (window.testRunner)
    testRunner.dumpAsText();

var e = document.getElementById("test");
var selection = window.getSelection();
selection.collapse(e, 0);

for (i = 0; i < 21; i++) {
    selection.modify("extend", "forward", "character");
    document.execCommand('bold', false, null);
}

document.body.appendChild(document.createTextNode(document.getElementById('test').innerHTML));

</script>

</body>
</html>
